<?php
    header('Content-type:text/json');
    require "../../connection.php";
    $data = NULL;
    try{
            $name = $_POST['name'];
            $zhname = $_POST['zhname'];
            $id = $_POST['id'];
            $arr = array("en_name"=>$name,"zh_name"=>$zhname);
            $option = array("id"=>$id);
            $result = $conn->where($option)->update("category",$arr);
            if($result){
                $msg = "更新成功";
                $data = $conn->doSql("select * from category");
            }else{
                $msg = "更新失败";
            }
            $data = array("status"=>"1","msg"=>$msg,"data"=>$data);
            echo json_encode($data);
    }catch(Exception $e){
        print_r($e->getMessage());
    }
?>